package com.liycloud.mall.product.controller;


import com.liycloud.common.core.util.ResultVo;
import com.liycloud.common.web.controller.BaseController;

import com.liycloud.mall.api.entity.OrderEntity;
import com.liycloud.mall.api.entity.ShopEntity;
import com.liycloud.mall.api.feign.OrderServiceFeignClient;
import com.liycloud.mall.product.service.ShopService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@AllArgsConstructor
@RequestMapping("/shop")
public class ShopController extends BaseController<ShopService, ShopEntity> {


	// FeignClient 调用远程服务
	private final OrderServiceFeignClient orderServiceFeignClient;


	/**
	 *  模拟测试  通过用户ID  查询该用户所有订单order
	 */
	@GetMapping("/test/getOrderByUserId/{userId}")
	ResultVo<List<OrderEntity>> getOrderByUserId(@PathVariable("userId") Integer userId){
		ResultVo<List<OrderEntity>> orderByUserId = orderServiceFeignClient.getOrderByUserId(userId);
		return  orderByUserId;
	}
}
